feat(facade): add single-core interfaces facade (F107)#372
Merged
Conversation
- `.go-arch-lint.yml`: register testutil-facadetest component and allow domain-transcript dependency in interface layers - `.specify/implementation/F107/tasks/index.json`: add F107 task implementation index - `.zpm/kb/pr_feature_f107_single_core_interfaces_facade/journal.wal`: add PR knowledge base journal - `.zpm/kb/pr_feature_f107_single_core_interfaces_facade/knowledge.pl`: add PR Prolog knowledge facts - `cmd/awf/main.go`: wire WorkflowFacade into application bootstrap - `docs/development/architecture.md`: document facade layer and single-core interface pattern - `internal/application/acp_session_service.go`: integrate facade session lifecycle management - `internal/application/acp_session_service_test.go`: add facade session service tests - `internal/application/drain.go`: add event drain for facade output flushing - `internal/application/drain_test.go`: add drain tests - `internal/application/error_codes.go`: add canonical error code mapping for facade - `internal/application/error_codes_test.go`: add error code tests - `internal/application/execution_setup_recorder_factory_test.go`: update for facade wiring - `internal/application/facade_adapter.go`: add WorkflowFacade adapter implementing ports.WorkflowFacade - `internal/application/facade_adapter_test.go`: add facade adapter tests - `internal/application/facade_projection.go`: add event-to-DTO projection for facade output - `internal/application/facade_projection_test.go`: add projection tests - `internal/application/input_bridge.go`: add input bridge translating CLI/API inputs to domain - `internal/application/input_bridge_test.go`: add input bridge tests - `internal/application/resolver.go`: add workflow identifier resolver consolidating prior implementations - `internal/application/resolver_test.go`: add resolver tests - `internal/application/resolver_wire.go`: add resolver wiring helpers - `internal/application/resolver_wire_test.go`: add resolver wire tests - `internal/application/run_session.go`: add RunSession orchestrating facade-driven workflow execution - `internal/application/run_session_test.go`: add run session tests - `internal/application/session_registry.go`: add session registry tracking active facade sessions - `internal/application/session_registry_test.go`: add session registry tests - `internal/domain/errors/codes.go`: add facade-specific error codes - `internal/domain/ports/facade.go`: define WorkflowFacade port interface - `internal/domain/ports/facade_contract_test.go`: add contract tests for facade port - `internal/domain/ports/facade_dto.go`: define facade input/output DTOs - `internal/domain/ports/facade_event.go`: define facade event types - `internal/infrastructure/transcript/fanout.go`: add mirror subscriber support for facade transcript - `internal/interfaces/api/respond_handler.go`: add respond handler consuming facade via SSE - `internal/interfaces/api/respond_handler_test.go`: add respond handler tests - `internal/interfaces/api/server.go`: wire facade into API server - `internal/interfaces/api/sse.go`: refactor SSE to consume facade events - `internal/interfaces/api/sse_test.go`: update SSE tests for facade-driven flow - `internal/interfaces/cli/config.go`: add facade configuration options - `internal/interfaces/cli/resume_list.go`: add resume list command via facade - `internal/interfaces/cli/resume_list_test.go`: add resume list tests - `internal/interfaces/cli/root.go`: wire facade into CLI root command - `internal/interfaces/cli/run.go`: delegate run command to facade - `internal/interfaces/cli/run_test.go`: add run command facade tests - `internal/interfaces/cli/status.go`: delegate status command to facade - `internal/interfaces/cli/status_test.go`: update status tests for facade - `internal/interfaces/cli/wiring_transcript.go`: update transcript wiring for facade - `internal/interfaces/tui/bridge.go`: add TUI bridge wrapping facade for Bubble Tea integration - `internal/interfaces/tui/bridge_test.go`: add TUI bridge tests - `internal/interfaces/tui/command.go`: refactor TUI commands to use facade bridge - `internal/interfaces/tui/command_test.go`: update TUI command tests - `internal/interfaces/tui/input_reader.go`: remove superseded input reader - `internal/interfaces/tui/messages.go`: add facade-driven TUI message types - `internal/interfaces/tui/model.go`: integrate facade bridge into TUI model - `internal/interfaces/tui/model_test.go`: add TUI model tests for facade integration - `internal/interfaces/tui/tab_monitoring.go`: refactor monitoring tab to consume facade events - `internal/interfaces/tui/tab_monitoring_test.go`: add monitoring tab tests - `internal/testutil/facadetest/doc.go`: add facadetest package documentation - `internal/testutil/facadetest/facadetest.go`: add scriptable WorkflowFacade fake for testing - `internal/testutil/facadetest/facadetest_test.go`: add facadetest self-tests - `tests/fixtures/facade/acp-session-update.golden`: add golden fixture for ACP session update - `tests/fixtures/facade/cli-stdout.golden`: add golden fixture for CLI stdout output - `tests/fixtures/facade/sse-frames.golden`: add golden fixture for SSE frames - `tests/fixtures/facade/tui-tea-msg.golden`: add golden fixture for TUI Tea messages - `tests/integration/features/agent_uniformity_test.go`: add agent uniformity integration test - `tests/integration/features/facade_conformance_test.go`: add facade conformance integration test - `tests/integration/features/facade_e2e_run_test.go`: add facade end-to-end run integration test - `tests/integration/features/facade_resume_test.go`: add facade resume integration test Closes #371
f06f9e0 to
6c44a88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WorkflowFacadeport that all interface entry points (CLI, TUI, HTTP/SSE, ACP) share, replacing the previous pattern where each interface directly called disparate application servicesRun/Validate/List/Historycontractrun,status,resume), TUI (monitoring tab, bridge), and HTTP (SSE handler, respond handler) while plumbing ACP session service to emit facade-compatible events; ships a reusablefacadetestharness so interface-layer tests can drive the facade with scripted scenariosChanges
Domain — Facade Contract
internal/domain/ports/facade.go: DefineWorkflowFacadeport withRun,Validate,List,Historymethodsinternal/domain/ports/facade_dto.go: AddRunRequest,RunResult,ListItem,HistoryEntryDTOsinternal/domain/ports/facade_event.go: Add typed facade event vocabulary (StepStarted,StepDone,OutputLine,Terminal, etc.)internal/domain/ports/facade_contract_test.go: Contract-level tests that any implementation must satisfyinternal/domain/errors/codes.go: Extend domain error codes used by the facade error taxonomyApplication — Facade Implementation
internal/application/facade_adapter.go:Adapterstruct implementingWorkflowFacade; delegates to resolver, session registry, and execution serviceinternal/application/facade_adapter_test.go: Comprehensive unit tests covering run, validate, terminal events, failure pathsinternal/application/resolver.go: Consolidate workflow identifier resolution (name → workflow entity) into a single canonical entry pointinternal/application/resolver_wire.go: Wire resolver with pack discoverer and repository fallbackinternal/application/resolver_test.go,internal/application/resolver_wire_test.go: Unit tests for both resolution pathsinternal/application/session_registry.go: In-memory registry tracking activeRunSessionby run IDinternal/application/session_registry_test.go: Concurrent-access tests for the registryinternal/application/run_session.go: Per-run session encapsulating event channel, cancel func, and statusinternal/application/run_session_test.go: Session lifecycle and terminal-event semantics testsinternal/application/drain.go: Helper that drains an event channel after execution completes to prevent in-flight event lossinternal/application/drain_test.go: Drain ordering and closure-safety testsinternal/application/facade_projection.go: Projects domain execution events onto typed facade eventsinternal/application/facade_projection_test.go: Projection mapping unit testsinternal/application/input_bridge.go: RoutesRunRequestinputs to the appropriate execution service methodinternal/application/input_bridge_test.go: Tests for fresh-run, resume, and dry-run dispatchinternal/application/error_codes.go: StructuredMapErrorfunction mapping domain errors to facade error codesinternal/application/error_codes_test.go: Exhaustive mapping tests for every error categoryinternal/application/acp_session_service.go: Extended to emit facade-compatible events over the ACP session channelinternal/application/acp_session_service_test.go: New test coverage for facade event emission pathsinternal/application/execution_setup_recorder_factory_test.go: Minor test fixture adjustmentInfrastructure
internal/infrastructure/transcript/fanout.go: Add fan-out subscriber support used by the facade's mirror subscriberInterface — CLI
internal/interfaces/cli/config.go: Build and lazily initialize facade inPersistentPreRunhookinternal/interfaces/cli/root.go: Extract root-command builder; return cleanup func; wire auto-facade modeinternal/interfaces/cli/run.go: Routeawf runthrough facade when availableinternal/interfaces/cli/run_test.go: Tests for facade-routed run commandinternal/interfaces/cli/status.go: Routeawf statusthrough facade session registryinternal/interfaces/cli/status_test.go: Updated tests for facade-aware status lookupinternal/interfaces/cli/resume_list.go: Newawf resume --listsub-command backed byfacade.Listinternal/interfaces/cli/resume_list_test.go: Tests for resume list outputinternal/interfaces/cli/wiring_transcript.go: Adjust transcript wiring to coexist with facade recorderInterface — TUI
internal/interfaces/tui/bridge.go: ImplementFacadeBridgewrapping facade for Bubble Tea message dispatchinternal/interfaces/tui/bridge_test.go: Tests for bridge event-to-message translationinternal/interfaces/tui/command.go: Switch execution command to use facade bridge; remove direct service callinternal/interfaces/tui/command_test.go: Updated; remove tests that relied on removed stubsinternal/interfaces/tui/tab_monitoring.go: Handle facade event messages in the monitoring tab event loopinternal/interfaces/tui/tab_monitoring_test.go: Full event-loop tests for facade-driven and nil-Done-channel pathsinternal/interfaces/tui/model.go: Thread facade reference through TUI modelinternal/interfaces/tui/model_test.go: Updated model testsinternal/interfaces/tui/messages.go: Add facade event message types for Bubble Teainternal/interfaces/tui/input_reader.go: Deleted — replaced byinput_bridge.goin the application layerInterface — HTTP/API
internal/interfaces/api/sse.go: Rewrite SSE handler to stream facade events instead of polling execution stateinternal/interfaces/api/sse_test.go: Updated SSE tests for facade event streaminginternal/interfaces/api/respond_handler.go: New handler that writes a single facade terminal event as a JSON responseinternal/interfaces/api/respond_handler_test.go: Tests for respond handler success and error casesinternal/interfaces/api/server.go: Register new respond route; inject facade into handlersTest Utilities
internal/testutil/facadetest/facadetest.go: ScriptableFakeFacadeallowing tests to pre-configure event sequencesinternal/testutil/facadetest/doc.go: Architecture doc for the facadetest packageinternal/testutil/facadetest/facadetest_test.go: Self-tests for the fake implementationIntegration Tests & Fixtures
tests/integration/features/facade_conformance_test.go: Contract conformance suite run against the real adaptertests/integration/features/facade_e2e_run_test.go: End-to-end run test through facadetests/integration/features/facade_resume_test.go: Resume flow integration testtests/integration/features/agent_uniformity_test.go: Verify CLI/TUI/HTTP all produce equivalent event sequencestests/fixtures/facade/cli-stdout.golden,tests/fixtures/facade/sse-frames.golden,tests/fixtures/facade/tui-tea-msg.golden,tests/fixtures/facade/acp-session-update.golden: Golden files for cross-interface output comparisonConfiguration & Tooling
.go-arch-lint.yml: Registertestutil-facadetestcomponent anddomain-transcriptdependency edges for CLI/TUI/API.specify/implementation/F107/tasks/index.json: Task manifest (T053–T065) tracking completion status.zpm/kb/pr_feature_f107_single_core_interfaces_facade/journal.wal,.zpm/kb/pr_feature_f107_single_core_interfaces_facade/knowledge.pl: ZPM project memory for this PRcmd/awf/main.go: UseNewRootCommandAutoFacadeand call cleanup on exitdocs/development/architecture.md: Document the facade layer and its relationship to existing hexagonal layersTest plan
make testpasses with zero failures across unit and integration suitesmake lintreports no violations (arch-lint component graph + golangci-lint)Closes #371
Generated with awf commit workflow